home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / SASETUP.MSI / F77674_adminweb_prop.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  55.6 KB  |  1,164 lines

  1. <%@ Language=VBScript%>
  2. <%    Option Explicit%>
  3. <%    
  4.     Response.Buffer = True
  5.     '------------------------------------------------------------------------- 
  6.     ' adminweb_prop.asp:    Allows for the configuration of IP addresses
  7.     '                         and set the port to listen for non-encrypted and 
  8.     '                        encrypted(SSL) HTTP admin web site.        
  9.     '
  10.     ' Copyright (c) Microsoft Corporation.  All rights reserved. 
  11.     '
  12.     ' Date                Description
  13.     ' 28-02-2001        Created date
  14.     ' 14-03-2001        Modified date
  15.     '-------------------------------------------------------------------------
  16. %>
  17.     <!-- #include virtual="/admin/inc_framework.asp" -->
  18.     <!-- #include file="loc_adminweb.asp" -->
  19. <%
  20.     '-------------------------------------------------------------------------
  21.     ' Global Variables and Constants
  22.     '-------------------------------------------------------------------------
  23.     
  24.     Dim G_objAdminService    'WMI server HTTP admin web site object
  25.     Dim G_objService        'WMI server object to get the IP addresses for NIC cards
  26.         
  27.     Dim rc                    'framework variable
  28.     Dim page                'framework variable
  29.     Dim SOURCE_FILE            'To hold source file name
  30.     
  31.     SOURCE_FILE = SA_GetScriptFileName()
  32.     
  33.     Const CONST_ARR_STATUS_CHECKED = "CHECKED"        'Constant for radio button checked property
  34.     Const CONST_ARR_STATUS_DISABLED = "DISABLED"    'Constant for disabling of SSL port
  35.     Const CONST_ARR_STATUS_TRUE = "YES"                'Constant for radio button status
  36.     Const CONST_ARR_STATUS_FALSE = "NO"                'Constant for radio button status
  37.     Const CONST_ARR_STATUS_NONE = "NONE"            'Constant for radio button status
  38.     
  39.     'Port Locations for shares list page
  40.     CONST CONST_DEFAULT_PORTNAME    ="AdminPort"    
  41.     CONST CONST_SSL_PORTNAME        ="SSLAdminPort"
  42.         
  43.     '-------------------------------------------------------------------------
  44.     'Form Variables
  45.     '-------------------------------------------------------------------------
  46.     Dim F_strNonEncryptedIPAddress        'IP Address to be used for Non-Encrypted port
  47.     Dim F_strEncryptedIPAddress            'IP Address to be used for Encrypted port
  48.     Dim F_nNonEncryptedPort                'Non-encrypted port number to be used
  49.     Dim F_nEncryptedPort                'Encrypted port number(SSL) to be used
  50.     Dim F_strradIPAdd                    'Value of radio button clicked
  51.     Dim F_strAll_IPAddress                'To set the status of the All IP address radio button 
  52.     Dim F_strJustthis_IPAddress            'To set the status of the Just this IP address radio button 
  53.     Dim F_strSSLPort_Status                'To set the status of the SSL port
  54.     
  55.     '-------------------------------------------------------------------------
  56.     'END of Form Variables
  57.     '-------------------------------------------------------------------------
  58.     
  59.     '
  60.     'Create a Property Page
  61.     rc = SA_CreatePage( L_PAGETITLE_ADMIN_TEXT , "", PT_PROPERTY, page )
  62.     
  63.     If (rc = 0) Then
  64.         'Serve the page
  65.         SA_ShowPage(page)
  66.     End If
  67.     
  68.     '---------------------------------------------------------------------
  69.     'Function:                OnInitPage()
  70.     'Description:            Called to signal first time processing for this page.
  71.     'Input Variables:        PageIn,EventArg
  72.     'Output Variables:        PageIn,EventArg
  73.     'Returns:                True/False
  74.     'Global Variables:        None
  75.     '---------------------------------------------------------------------
  76.     Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  77.         
  78.         'Make it initialize to default always 
  79.         F_strSSLPort_Status=""
  80.         
  81.         'To get the admin web settings
  82.         OnInitPage = GetSystemSettings()
  83.         
  84.     End Function
  85.     
  86.     '-------------------------------------------------------------------------
  87.     'Function:                OnPostBackPage()
  88.     'Description:            Called to signal that the page has been posted-back.
  89.     'Input Variables:        PageIn,EventArg
  90.     'Output Variables:        PageIn,EventArg
  91.     'Returns:                True/False
  92.     'Global Variables:        F_(*)
  93.     '-------------------------------------------------------------------------
  94.     Public Function OnPostBackPage(ByRef PageIn,ByRef EventArg)
  95.         
  96.         Call SA_TraceOut( SOURCE_FILE, "OnPostBackPage")
  97.         
  98.         'Get the values from hidden variables
  99.         F_strradIPAdd = Request.Form("hdnIPAddressstatus")
  100.         F_nNonEncryptedPort = Request.Form("hdnNonencryptedPort")
  101.         F_nEncryptedPort = Request.Form("hdnEncryptedPort")
  102.         F_strSSLPort_Status = Request.Form("hdnSSLPortstatus")
  103.                         
  104.         If Ucase(F_strradIPAdd) = CONST_ARR_STATUS_TRUE then
  105.             F_strNonEncryptedIPAddress=""
  106.             F_strEncryptedIPAddress=""
  107.         ElseIf Ucase(F_strradIPAdd) = CONST_ARR_STATUS_FALSE Then 
  108.             F_strNonEncryptedIPAddress = Request.Form("hdnNonEncryptedIPAddress")
  109.             F_strEncryptedIPAddress = Request.Form("hdnEncryptedIPAddress")
  110.         End If
  111.         
  112.         'Getting the radio buttons status
  113.         If Ucase(F_strradIPAdd) = CONST_ARR_STATUS_TRUE Then 
  114.             F_strAll_IPAddress = CONST_ARR_STATUS_CHECKED
  115.             F_strJustthis_IPAddress =""
  116.         ElseIf Ucase(F_strradIPAdd) = CONST_ARR_STATUS_FALSE Then
  117.             F_strJustthis_IPAddress = CONST_ARR_STATUS_CHECKED
  118.             F_strAll_IPAddress = ""
  119.         Else
  120.             F_strJustthis_IPAddress = ""
  121.             F_strAll_IPAddress = ""
  122.         End if         
  123.         
  124.         OnPostBackPage=TRUE
  125.         
  126.     End Function
  127.     
  128.     '---------------------------------------------------------------------
  129.     'Function:                OnSubmitPage()
  130.     'Description:            Called when the page has been submitted for processing.
  131.     'Input Variables:        PageIn,EventArg
  132.     'Output Variables:        PageIn,EventArg
  133.     'Returns:                True/False
  134.     'Global Variables:        G_objAdminService,G_objService,L_WMICONNECTIONFAILED_ERRORMESSAGE,
  135.     '                        CONST_WMI_IIS_NAMESPACE, CONST_WMI_WIN32_NAMESPACE
  136.     '---------------------------------------------------------------------
  137.     Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  138.         
  139.         Err.Clear 
  140.         On Error Resume Next
  141.         
  142.         'Connecting to the WMI server
  143.         Set G_objAdminService    = GetWMIConnection(CONST_WMI_IIS_NAMESPACE) 
  144.         Set G_objService        = GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  145.         
  146.         If Err.number <> 0 Then
  147.             Call SA_ServeFailurePage (L_WMICONNECTIONFAILED_ERRORMESSAGE & " (" & HEX(Err.Number) & ")" )
  148.         End if
  149.         
  150.         'To set the admin web settings
  151.         OnSubmitPage = SetAdminConfig(G_objAdminService,G_objService)
  152.         
  153.     End Function
  154.     
  155.     '---------------------------------------------------------------------
  156.     'Function:                OnClosePage()
  157.     'Description:            Called when the page is about to be closed.
  158.     'Input Variables:        PageIn,EventArg
  159.     'Output Variables:        PageIn,EventArg
  160.     'Returns:                True/False
  161.     'Global Variables:        None
  162.     '---------------------------------------------------------------------
  163.     Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  164.     
  165.         OnClosePage = TRUE
  166.         
  167.     End Function
  168.     
  169.     '-------------------------------------------------------------------------
  170.     'Function:                OnServePropertyPage
  171.     'Description:            Called when the page needs to be served.
  172.     'Input Variables:        PageIn,EventArg
  173.     'Output Variables:        PageIn,EventArg
  174.     'Returns:                True/False
  175.     'Global Variables:        F_(*), L_(*)
  176.     '-------------------------------------------------------------------------    
  177.     Public Function OnServePropertyPage(ByRef PageIn,ByRef EventArg)
  178.         
  179.         Call ServeCommonJavaScript()
  180.         
  181. %>
  182.         <table border=0>
  183.             <tr>
  184.                 <td nowrap class = "TasksBody"  colspan=2>
  185.                     <%=L_ADMINUSAGE_TEXT%>        
  186.                 </td>
  187.             </tr>
  188.             <tr>
  189.                 <td class = "TasksBody" ></td>
  190.             </tr>
  191.             <tr>
  192.                 <td class = "TasksBody">
  193.                      
  194.                 </td>
  195.                 <td nowrap class = "TasksBody">
  196.                     <input type="radio" value="YES" class="FormField" name=radIPADDRESS <%=Server.HTMLEncode(F_strAll_IPAddress)%> onClick="EnableControls(false)">   <%=L_ALLIPADDRESS_TEXT%>
  197.                 </td>
  198.             </tr>
  199.             <tr>
  200.                 <td class = "TasksBody">
  201.                      
  202.                 </td>
  203.                 <td nowrap class = "TasksBody">
  204.                     <input type="radio" value="NO" class="FormField" name=radIPADDRESS <%=Server.HTMLEncode(F_strJustthis_IPAddress)%> onClick="EnableControls(true)">   <%=L_JUSTTHIS_IP_ADDRESS_TEXT%>
  205.                 </td>
  206.             </tr>
  207.             <tr>
  208.                 <td class = "TasksBody" colspan="2">
  209.                 </td>
  210.             </tr>
  211.             <tr>
  212.                 <td class = "TasksBody">
  213.                      
  214.                 </td>
  215.                 <td class = "TasksBody" colspan="3">        
  216.                     <select name="cboIPAddress" class="FormField">
  217.                         <%GetSystemNICConfig F_strNonEncryptedIPAddress%>
  218.                     </select>
  219.                 </td>
  220.             </tr>
  221.             <tr>
  222.                 <td class = "TasksBody">
  223.                      
  224.                 </td>
  225.                 <td nowrap class = "TasksBody">
  226.                     <%=L_PORT_TEXT%>     <input type="text" name="txtNonEncryptedPort"  class="FormField" size="15" maxlength = "5" value="<%=F_nNonEncryptedPort%>" OnKeypress="javascript:checkKeyforNumbers(this);" >  
  227.                 </td>
  228.             </tr>
  229.             <tr>
  230.                 <td class = "TasksBody">
  231.                      
  232.                 </td>
  233.                 <td class = "TasksBody">
  234.                     <%=L_SSLPORT_TEXT%>   <input type="text" name="txtEncryptedPort"  class="FormField" size="15" maxlength = "5" <%=F_strSSLPort_Status%> value="<%=F_nEncryptedPort%>" OnKeypress="javascript:checkKeyforNumbers(this);" >  
  235.                 </td>
  236.             </tr>
  237.             <tr>
  238.                 <td class = "TasksBody" colspan =2>
  239.                          
  240.                 </td>
  241.             </tr>
  242.             <tr>
  243.                 <td class = "TasksBody" colspan =2>
  244.                     <%=L_ADMINNOTE_TEXT%>        
  245.                 </td>
  246.             </tr>
  247.         </table>
  248.         
  249.         <input type=hidden name=hdnNonEncryptedIPAddress value ="<%=F_strNonEncryptedIPAddress%>">
  250.         <input type=hidden name=hdnEncryptedIPAddress value ="<%=F_strEncryptedIPAddress%>">
  251.         <input type=hidden name=hdnNonencryptedPort value ="<%=F_nNonEncryptedPort%>">
  252.         <input type=hidden name=hdnEncryptedPort value ="<%=F_nEncryptedPort%>">
  253.         <input type=hidden name=hdnIPAddressstatus value ="<%=F_strradIPAdd%>">    
  254.         <input type=hidden name=hdnSSLPortstatus value ="<%=F_strSSLPort_Status%>">    
  255.     
  256. <%
  257.          OnServePropertyPage=TRUE    
  258.         
  259.     End Function
  260.  
  261.     '-------------------------------------------------------------------------
  262.     'Function:                ServeCommonJavaScript
  263.     'Description:            Serves in initializing the values,setting the form
  264.     '                        data and validating the form values
  265.     'Input Variables:        None
  266.     'Output Variables:        None
  267.     'Returns:                True/False
  268.     'Global Variables:        L_(*),F_(*)
  269.     '-------------------------------------------------------------------------
  270.     Function ServeCommonJavaScript()
  271. %>
  272.         <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js"></script>
  273.         <script language="JavaScript">
  274.             
  275.             var CONST_ARR_INDEX_ALL_IP = 0
  276.             var CONST_ARR_INDEX_JUST_THIS_IP = 1
  277.             
  278.             /* Init Function calls the EnableControls function to enable or disable the controls for the first time
  279.                 and enable or disable the OK button */
  280.             function Init() 
  281.             {    
  282.                 var strNonEncryptedIPAddress = "<%=F_strNonEncryptedIPAddress%>"
  283.                 var strEncryptedIPAddress = "<%=F_strEncryptedIPAddress%>"
  284.                                 
  285.                 //If sites are configured at different IP addresses disable OK button
  286.                 if(strNonEncryptedIPAddress.value != strEncryptedIPAddress)
  287.                 {
  288.                     DisableOK();
  289.                     document.frmTask.cboIPAddress.disabled =true;    
  290.                 }
  291.                 
  292.                 //Enabling or disabling of OK button depending on the status of radion button
  293.                 if(document.frmTask.radIPADDRESS[CONST_ARR_INDEX_ALL_IP].checked)                    
  294.                     EnableControls(false)
  295.                 else if(document.frmTask.radIPADDRESS[CONST_ARR_INDEX_JUST_THIS_IP].checked)
  296.                     EnableControls(true)
  297.             }
  298.             
  299.             // Hidden Varaibles are updated in ValidatePage
  300.             function ValidatePage() 
  301.             { 
  302.                 //Updating the hidden variables
  303.                 document.frmTask.hdnNonEncryptedIPAddress.value = document.frmTask.cboIPAddress.value
  304.                 document.frmTask.hdnNonencryptedPort.value = document.frmTask.txtNonEncryptedPort.value
  305.                 document.frmTask.hdnEncryptedPort.value = document.frmTask.txtEncryptedPort.value
  306.                                 
  307.                 if (document.frmTask.radIPADDRESS[CONST_ARR_INDEX_ALL_IP].checked)
  308.                     document.frmTask.hdnIPAddressstatus.value = document.frmTask.radIPADDRESS[CONST_ARR_INDEX_ALL_IP].value
  309.                 else if(document.frmTask.radIPADDRESS[CONST_ARR_INDEX_JUST_THIS_IP].checked)
  310.                     document.frmTask.hdnIPAddressstatus.value = document.frmTask.radIPADDRESS[CONST_ARR_INDEX_JUST_THIS_IP].value
  311.                 
  312.                 //If Non-Encrypted Port is left blank display error
  313.                 if (document.frmTask.txtNonEncryptedPort.value == "")
  314.                 {
  315.                     SA_DisplayErr('<%=SA_EscapeQuotes(L_ENTERPORTNUMBER_ERRORMESSAGE) %>');
  316.                     document.frmTask.onkeypress = ClearErr
  317.                     return false;
  318.                 }
  319.                 
  320.                 //If Encrypted Port is left blank display error
  321.                 if (document.frmTask.txtEncryptedPort.value == "")
  322.                 {
  323.                     SA_DisplayErr('<%=SA_EscapeQuotes(L_ENTERPORTNUMBER_ERRORMESSAGE) %>');
  324.                     document.frmTask.onkeypress = ClearErr
  325.                     return false;
  326.                 }
  327.                 
  328.                 //If Non-Encrypted port number is less than 1 or greater then 65535 display error
  329.                 
  330.                 var MAX_PORT_NO = 65535
  331.                 var MIN_PORT_NO = 1
  332.                 
  333.                 if (document.frmTask.txtNonEncryptedPort.value > MAX_PORT_NO || document.frmTask.txtNonEncryptedPort.value < MIN_PORT_NO)
  334.                 {
  335.                     SA_DisplayErr('<%=SA_EscapeQuotes(L_VALIDENTERPORTNUMBER_ERRORMESSAGE) %>');
  336.                     document.frmTask.onkeypress = ClearErr
  337.                     return false;
  338.                 }
  339.                  
  340.                  //If Encrypted port number is less than 1 or greater then 65535 display error
  341.                  if (document.frmTask.txtEncryptedPort.value > MAX_PORT_NO || document.frmTask.txtEncryptedPort.value < MIN_PORT_NO)
  342.                 {
  343.                     SA_DisplayErr('<%=SA_EscapeQuotes(L_VALIDENTERPORTNUMBER_ERRORMESSAGE) %>');
  344.                     document.frmTask.onkeypress = ClearErr
  345.                     return false;
  346.                 }
  347.                 
  348.                 //If Non-Encrypted Port and Encrypted Port numbers are the same display error
  349.                 if (document.frmTask.txtNonEncryptedPort.value == document.frmTask.txtEncryptedPort.value)
  350.                  {
  351.                      SA_DisplayErr('<%=SA_EscapeQuotes(L_PORTNUMBERS_ERRORMESSAGE)%>');
  352.                     document.frmTask.onkeypress = ClearErr
  353.                     return false;
  354.                  }
  355.                  return true;                        
  356.             }
  357.             
  358.             //SetData function for the Framework.
  359.             function SetData()
  360.             {
  361.             
  362.             }
  363.             
  364.             // EnableControls Function is to enable or disable the controls depending on radio button value
  365.             function EnableControls(blnFlag)
  366.             {    
  367.                 EnableOK();
  368.                 if (blnFlag)
  369.                 {                    
  370.                     document.frmTask.cboIPAddress.disabled = false;
  371.                 }
  372.                 else
  373.                 {
  374.                     document.frmTask.cboIPAddress.disabled =true;                
  375.                 }
  376.              }
  377.              
  378.         </script>
  379. <%
  380.     End Function
  381.  
  382.     '-------------------------------------------------------------------------
  383.     'Function name:        SetAdminConfig()
  384.     'Description:        Serves in configuring IP address, encrypted port 
  385.     '                    and non-encrypted port of HTTP admin web site
  386.     'Input Variables:    G_objAdminService, G_objService
  387.     'Output Variables:    True or false
  388.     'Returns:            None
  389.     'Global Variables:    F_strNonEncryptedIPAddress,F_nNonEncryptedPort,F_nEncryptedPort,L_(*)
  390.     'This function configures the IP address, encrypted port and non-encrypted  of HTTP admin web site 
  391.     '-------------------------------------------------------------------------                    
  392.     Function SetAdminConfig(G_objAdminService,G_objService)
  393.     
  394.         Err.Clear 
  395.         On Error Resume Next
  396.         
  397.         Dim objAdminService            'Object to get instance of MicrosoftIISV1
  398.         Dim objService                'Object to get instance of CIMV2
  399.         Dim objNetWorkCon            'To get instance of IIs_WebServerSetting class
  400.         Dim objServerSetting        'To get instances of IIs_WebServerSetting class
  401.         Dim objNACCollection        'To get instance of IIs_WebServerSetting where site is other than Administration
  402.         Dim objinst                    'To get instances of IIs_WebServerSetting where site is other than Administration
  403.         Dim nport                    'Non-Encrypted port number
  404.         Dim strWMIpath                'WMI query to get admin web site        
  405.         Dim strServerBindings        'To store the values obtained from ServerBindings property
  406.         Dim strIPAddress            'String to store the IP address for non-encrypted sites            
  407.         Dim arrWinsSrv                'Array to store the IP address and non-encrypted port number
  408.         Dim arrIPAdd                'Array to store the port for encrypted sites 
  409.         Dim nIPCount                'Count for getting the IP address and non-encrypted port number
  410.         Dim arrPort                    'Array to store the port for non-encrypted sites 
  411.         Dim strReturnURL            'Stores return URL
  412.         Dim objConfiguredIPs        'To get instance of win32_NetworkAdapterConfiguration
  413.         Dim objNICIP                'To get instances of win32_NetworkAdapterConfiguration
  414.         Dim strNICQuery                'Query to get all IP addresses
  415.         Dim nCount                    'Count for getting the IP address and non-encrypted port number
  416.         Dim arrIPList(13)            'Array to store the IP addresses for all NIC cards
  417.         Dim nIPlistCount            'Count to get IP addresses for all NIC cards
  418.         Dim strIPFlag                'Boolean value to store the validity of IP address
  419.         Dim strAdminWebSite            'Admin web site name
  420.         Dim strFTPSite                'FTP site name
  421.         Dim strFTPpath                'FTP site path
  422.         Dim nFTPIPCount                'Count for getting the IP address and port number for FTP site
  423.         Dim strFTPServerBindings    'To store the values obtained from ServerBindings property for FTP site
  424.         Dim arrFTPWinsSrv            'Array to store the IP address and port for FTP site 
  425.         Dim arrFTPIPAdd                'Array to store the IP address FTP site
  426.         Dim    arrFTPPort                'Array to store the port for FTP site
  427.         Dim objFTPinst                'Gettings instances for FTP site
  428.         Dim objFTPInstances            'Object instance for FTP site
  429.         Dim strComputerName            'Computer name
  430.         Dim nSecureCount            'Count for getting the IP address and encrypted port number
  431.         Dim arrSecureIPAdd            'Array to store the IP address for encrypted sites 
  432.         Dim arrSecurePort            'Array to store the port for encrypted sites 
  433.         Dim arrWinsSecure            'Array to store the IP address and encrypted port number
  434.         Dim strSecureBindings        'To store the values obtained from SecureBindings property
  435.         Dim nSecurePort                'Encrypted port number
  436.         Dim strURL                    'URL for non encrypted site
  437.         Dim strHTTPURL                'URL for encrypted site
  438.         Dim arrVarReplacementStringsAdminWeb(1) ' For localisation
  439.         Dim strErrMsg                'Error message
  440.         
  441.         Const CONST_ARR_INDEX_IP = 0            'For IP address
  442.         Const CONST_ARR_INDEX_PORT = 1            'For port number
  443.         Const CONST_ARR_INDEX_HTTPS = "HTTPS"    'For secure site
  444.         
  445.         
  446.         SetAdminConfig = FALSE    'initialization default
  447.         
  448.         Call SA_TraceOut( SOURCE_FILE, "SetAdminConfig")
  449.                 
  450.         'Getting the return URL
  451.         'That's a quick fix for 2.1 since in 2.1 administration site actually is 
  452.         'under the virtual directory /admin. 
  453.         If CONST_OSNAME_XPE = GetServerOSName() Then                
  454.             strReturnURL = "/Admin/tasks.asp?" & SAI_FLD_PAGEKEY & "=" & SAI_GetPageKey() & "&tab1="        
  455.         Else
  456.             strReturnURL = "/Admin/tasks.asp?" & SAI_FLD_PAGEKEY & "=" & SAI_GetPageKey() & "&tab1="        
  457.         End If    
  458.         
  459.         'FTP site name
  460.         strFTPSite = "MSFTPSVC/1"
  461.             
  462.         'Assign global objects to local objects
  463.         Set objAdminService    = G_objAdminService
  464.         Set objService        = G_objService
  465.         
  466.         'Get the HTTP admin web site name
  467.         strAdminWebSite = GetAdminWebSite(objAdminService)
  468.         
  469.         'To get instances of Web sites other than Administration                
  470.         strWMIpath = "select * from " & GetIISWMIProviderClassName("IIs_WebServerSetting") & " where Name != " & Chr(34)& strAdminWebSite & Chr(34)
  471.         Set objNACCollection = objAdminService.ExecQuery(strWMIpath)
  472.                 
  473.         If Err.Number <> 0 Then
  474.             Call SA_SetErrMsg (L_IIS_WEBSERVERCONNECTION_ERRORMESSAGE & " (" & HEX(Err.Number) & ")" )
  475.             Exit Function
  476.         End If
  477.         
  478.         arrVarReplacementStringsAdminWeb(0) = Cstr(F_nNonEncryptedPort)
  479.         strErrMsg = SA_GetLocString("adminweb.dll", "4045000F", arrVarReplacementStringsAdminWeb)
  480.                                 
  481.         For each objinst in objNACCollection
  482.             
  483.             'If other web site is configured with the same IP address and non-encrypted port number display error
  484.             If IsArray(objinst.ServerBindings) Then 
  485.                 For nIPCount = 0 to ubound(objinst.ServerBindings)        
  486.                     strServerBindings = objinst.ServerBindings(nIPCount)
  487.                     
  488.                     if IsIIS60Installed() Then
  489.                     
  490.                         If isObject(objinst.ServerBindings(nIPCount)) Then
  491.  
  492.                             arrIPAdd = objinst.ServerBindings(nIPCount).IP
  493.                             arrPort = objinst.ServerBindings(nIPCount).Port
  494.  
  495.                             'Duplicate the code here 
  496.                             If F_strNonEncryptedIPAddress <> "" then 
  497.                                 If arrIPAdd = F_strNonEncryptedIPAddress and arrPort = F_nNonEncryptedPort then 
  498.                                     Call SA_SetErrMsg (strErrMsg)
  499.                                     Exit Function
  500.                                 End if
  501.                             Else
  502.                                 If arrPort = F_nNonEncryptedPort then 
  503.                                     Call SA_SetErrMsg (strErrMsg)
  504.                                     Exit Function
  505.                                 End if
  506.                             End if
  507.                                                 
  508.                         End If 'If isobject(...)
  509.                     
  510.                     Else
  511.                                         
  512.                         If strServerBindings <> "" then
  513.                             'split the strServerBindings array to get the IP address and non-encrypted port
  514.                             arrWinsSrv = split(strServerBindings,":")        
  515.                             arrIPAdd = arrWinsSrv(CONST_ARR_INDEX_IP)
  516.                             arrPort = arrWinsSrv(CONST_ARR_INDEX_PORT)
  517.             
  518.                             If F_strNonEncryptedIPAddress <> "" then 
  519.                                 If arrIPAdd = F_strNonEncryptedIPAddress and arrPort = F_nNonEncryptedPort then 
  520.                                     Call SA_SetErrMsg (strErrMsg)
  521.                                     Exit Function
  522.                                 End if
  523.                             Else
  524.                                 If arrPort = F_nNonEncryptedPort then 
  525.                                     Call SA_SetErrMsg (strErrMsg)
  526.                                     Exit Function
  527.                                 End if
  528.                             End if
  529.                         End If
  530.                     
  531.                     End If 'IsIIS60Installed                    
  532.                     
  533.                 Next
  534.             End If
  535.             
  536.             'If other web site is configured with the same IP address and encrypted port number display error
  537.             If IsArray(objinst.SecureBindings) Then 
  538.                 For nSecureCount = 0 to ubound(objinst.SecureBindings)
  539.                     strSecureBindings = objinst.SecureBindings(nSecureCount)
  540.                     
  541.                     if IsIIS60Installed() Then
  542.                     
  543.                         If IsObject(objinst.SecureBindings(nSecureCount)) Then
  544.                         
  545.                             arrSecureIPAdd = objinst.SecureBindings(nSecureCount).IP
  546.                             arrSecurePort = objinst.SecureBindings(nSecureCount).Port
  547.                     
  548.                             ' Check if the secure port is empty or not
  549.                             If IsEmpty(arrSecurePort) or IsNull(arrSecurePort) Then                            
  550.                                 arrSecurePort = ""                                
  551.                             Else                    
  552.                                 'Get rid of the ':'
  553.                                 arrSecurePort = CLng(Replace(arrSecurePort, ":", ""))            
  554.                             End If
  555.             
  556.                             If F_strEncryptedIPAddress <> "" then 
  557.                                 If arrSecureIPAdd = F_strEncryptedIPAddress and arrSecurePort = F_nEncryptedPort then 
  558.                                     Call SA_SetErrMsg (strErrMsg)
  559.                                     Exit Function
  560.                                 End if
  561.                             Else
  562.                                 If arrSecurePort = F_nEncryptedPort then 
  563.                                     Call SA_SetErrMsg (strErrMsg)
  564.                                     Exit Function
  565.                                 End if
  566.                             End if
  567.                                                 
  568.                         End If 'If IsObject(..)                    
  569.                     
  570.                     Else
  571.                     
  572.                         If strSecureBindings <> "" then
  573.                             'split the strSecureBindings array to get the IP address and non-encrypted port
  574.                             arrWinsSecure = split(strSecureBindings,":")        
  575.                             arrSecureIPAdd = arrWinsSecure(CONST_ARR_INDEX_IP)
  576.                             arrSecurePort = arrWinsSecure(CONST_ARR_INDEX_PORT)
  577.             
  578.                             If F_strEncryptedIPAddress <> "" then 
  579.                                 If arrSecureIPAdd = F_strEncryptedIPAddress and arrSecurePort = F_nEncryptedPort then 
  580.                                     Call SA_SetErrMsg (strErrMsg)
  581.                                     Exit Function
  582.                                 End if
  583.                             Else
  584.                                 If arrSecurePort = F_nEncryptedPort then 
  585.                                     Call SA_SetErrMsg (strErrMsg)
  586.                                     Exit Function
  587.                                 End if
  588.                             End if
  589.                         End if
  590.                     
  591.                     End If 'if IsIIS60Installed()
  592.                     
  593.                 Next
  594.                 
  595.             End If    
  596.             
  597.         Next 
  598.         
  599.         'Display error if not able to verify with other web sites IP address and port number        
  600.         If Err.Number <> 0 Then            
  601.             Call SA_SetErrMsg (L_FAILEDTO_VERIFY_IPADD_PORT_ERRORMESSAGE)
  602.             Exit Function
  603.         End If
  604.         
  605.         'To get the instance of FTP server settings
  606.         strFTPpath = "select * from " & GetIISWMIProviderClassName("IIS_FtpServerSetting") & " where Name = " & chr(34) & strFTPSite & chr(34)
  607.         Set objFTPInstances = objAdminService.ExecQuery(strFTPpath)
  608.                 
  609.         If Err.Number <> 0 Then
  610.             Call SA_SetErrMsg (L_IIS_WEBSERVERCONNECTION_ERRORMESSAGE & " (" & HEX(Err.Number) & ")")
  611.             Exit Function
  612.         End If
  613.         
  614.         'Display error if Administration site is configured at same IP address and non-encrypted port number as FTP site 
  615.         For each objFTPinst in objFTPInstances
  616.             If IsArray(objFTPinst.ServerBindings) Then 
  617.                 For nFTPIPCount = 0 to ubound(objFTPinst.ServerBindings)        
  618.                     strFTPServerBindings = objFTPinst.ServerBindings(nFTPIPCount)
  619.                                         
  620.                     if IsIIS60Installed() Then
  621.                     
  622.                         If IsObject(objFTPinst.ServerBindings(nFTPIPCount)) then
  623.                             'split the strFTPServerBindings array to get the IP address and port
  624.                             
  625.                             arrFTPIPAdd = objFTPinst.ServerBindings(nFTPIPCount).IP
  626.                             arrFTPPort = objFTPinst.ServerBindings(nFTPIPCount).Port
  627.                                         
  628.                             If F_strNonEncryptedIPAddress <> "" then 
  629.                                 If arrFTPIPAdd = F_strNonEncryptedIPAddress and arrFTPPort = F_nNonEncryptedPort then 
  630.                                     Call SA_SetErrMsg (strErrMsg)
  631.                                     Exit Function
  632.                                 ElseIf arrFTPIPAdd = "" and arrFTPPort = F_nNonEncryptedPort then 
  633.                                     Call SA_SetErrMsg (strErrMsg)
  634.                                     Exit Function
  635.                                 End if
  636.                             Else
  637.                                 If arrFTPPort = F_nNonEncryptedPort then 
  638.                                     Call SA_SetErrMsg (strErrMsg)
  639.                                     Exit Function
  640.                                 End if
  641.                             End if
  642.                             
  643.                         End if 'If IsObject(...)
  644.                                         
  645.                     Else
  646.                     
  647.                         If strFTPServerBindings <> "" then
  648.                             'split the strFTPServerBindings array to get the IP address and port
  649.                             arrFTPWinsSrv = split(strFTPServerBindings,":")        
  650.                             arrFTPIPAdd = arrFTPWinsSrv(CONST_ARR_INDEX_IP)
  651.                             arrFTPPort = arrFTPWinsSrv(CONST_ARR_INDEX_PORT)
  652.                                         
  653.                             If F_strNonEncryptedIPAddress <> "" then 
  654.                                 If arrFTPIPAdd = F_strNonEncryptedIPAddress and arrFTPPort = F_nNonEncryptedPort then 
  655.                                     Call SA_SetErrMsg (strErrMsg)
  656.                                     Exit Function
  657.                                 ElseIf arrFTPIPAdd = "" and arrFTPPort = F_nNonEncryptedPort then 
  658.                                     Call SA_SetErrMsg (strErrMsg)
  659.                                     Exit Function
  660.                                 End if
  661.                             Else
  662.                                 If arrFTPPort = F_nNonEncryptedPort then 
  663.                                     Call SA_SetErrMsg (strErrMsg)
  664.                                     Exit Function
  665.                                 End if
  666.                             End if
  667.                         End if
  668.                     
  669.                     End If 'if IsIIS60Installed() 
  670.                     
  671.                 Next
  672.             End If
  673.         Next 
  674.         
  675.         'Display error if not able to verify with FTP site IP address and port number        
  676.         If Err.Number <> 0 Then
  677.             Call SA_SetErrMsg (L_FAILEDTO_VERIFY_IPADD_PORT_ERRORMESSAGE)
  678.             Exit Function
  679.         End If
  680.         
  681.         'Release objects
  682.         Set objFTPinst = Nothing
  683.         Set objFTPInstances = Nothing
  684.         
  685.         'Assigning values to local variables
  686.         strIPAddress = F_strNonEncryptedIPAddress 
  687.         nport = CLng(F_nNonEncryptedPort)
  688.         nSecurePort = CLng(F_nEncryptedPort)
  689.         
  690.         'To get instance of win32_NetworkAdapterConfiguration class
  691.         strNICQuery = "select * from win32_NetworkAdapterConfiguration Where IPEnabled = true"
  692.         Set objConfiguredIPs = objService.ExecQuery(strNICQuery)
  693.          
  694.         If Err.number <> 0 then
  695.             Call SA_ServeFailurePage (L_FAILEDTOGET_IPADDRESS_ERRORMESSAGE  & " (" & HEX(Err.Number) & ")" )
  696.             Exit Function
  697.         End If
  698.         
  699.         'Getting the NIC IP addresses        
  700.         For each objNICIP in objConfiguredIPs
  701.             arrIPList(nIPlistCount) = objNICIP.IPAddress(nCount)
  702.             nIPlistCount = nIPlistCount+1
  703.         Next
  704.         
  705.         'Release objects
  706.         Set objConfiguredIPs = nothing
  707.         Set objNICIP = nothing
  708.         
  709.         'To check whether the selected IP address is a valid IP address
  710.         For nCount = 0 to nIPlistCount-1
  711.             If strIPAddress = arrIPList(nCount) or strIPAddress = "" Then
  712.                 strIPFlag = true
  713.                 Exit For
  714.             else
  715.                 strIPFlag = false
  716.             End If
  717.         Next
  718.         
  719.         'If selected Ip address is invalid display error                
  720.         If strIPFlag = false then
  721.             Call SA_SetErrMsg (L_INVALID_IPADDRESS_ERRORMESSAGE)
  722.             Exit Function
  723.         End if
  724.             
  725.         'Getting the IIS_WEB Server Setting instance 
  726.         Set objNetWorkCon = objAdminService.ExecQuery("Select * from " & GetIISWMIProviderClassName("IIs_WebServerSetting")  & " where Name=" & Chr(34)& strAdminWebSite & Chr(34))
  727.         
  728.         If Err.Number <> 0 Then
  729.             Call SA_SetErrMsg (L_IIS_WEBSERVERCONNECTION_ERRORMESSAGE & " (" & HEX(Err.Number) & ")" )
  730.             Exit Function
  731.         End If
  732.         
  733.         'Assign local variable mstrReturnURL
  734.         'For 2.2, only https supported
  735.         If ( Request.ServerVariables( "SERVER_PORT_SECURE" ) )  Then
  736.             strHTTPURL =   "https"
  737.         Else
  738.             strHTTPURL =   "https"
  739.         End If
  740.         
  741.         'Loop to set the IP address and non-encrypted port number or encrypted port number depending on the
  742.         'Secure Certificate being provided
  743.         For each objServerSetting in objNetWorkCon 
  744.                         
  745.             if IsIIS60Installed() Then
  746.                                         
  747.                 objServerSetting.ServerBindings(0).IP = strIPAddress        'IP Address
  748.                 objServerSetting.ServerBindings(0).Port = nport                'Port                                
  749.                                 
  750.                 objServerSetting.SecureBindings(0).IP = strIPAddress        'IP Address
  751.                 objServerSetting.SecureBindings(0).Port = nSecureport        'Port                                
  752.             
  753.             Else 
  754.             
  755.                 'Assigning values to properties
  756.                 objServerSetting.ServerBindings = array(strIPAddress & ":" & nport & ":")
  757.                 objServerSetting.SecureBindings = array(strIPAddress & ":" & nSecureport & ":")
  758.             
  759.             End If ' if IsIIS60Installed()                                    
  760.             
  761.             'To get the computer name
  762.             strComputerName = GetComputerName()
  763.             
  764.             'Error in getting Computer name
  765.             If Err.Number <> 0 Then
  766.                 Call SA_ServeFailurePage (L_COMPUTERNAME_ERRORMESSAGE  & " (" & HEX(Err.Number) & ")" )
  767.                 Exit Function
  768.             End If
  769.             
  770.             'If Secure Certificate is not provided change the URL
  771.             If Ucase(strHTTPURL) <> CONST_ARR_INDEX_HTTPS then     
  772.                 If strIPAddress = "" then
  773.                     mstrReturnURL = "https://"& strComputerName & ":" & nport & strReturnURL & GetTab1()
  774.                 Else
  775.                     mstrReturnURL = "https://"& strIPAddress & ":" & nport & strReturnURL & GetTab1()
  776.                 End if
  777.             Else
  778.                 'If Secure Certificate is provided change the URL
  779.                 If Ucase(F_strSSLPort_Status) <> CONST_ARR_STATUS_DISABLED then 
  780.                     If strIPAddress = "" then
  781.                         mstrReturnURL = "https://"& strComputerName & ":" & nSecureport & strReturnURL & GetTab1()
  782.                         
  783.                     Else
  784.                         mstrReturnURL = "https://"& strIPAddress & ":" & nSecureport & strReturnURL & GetTab1()
  785.                     End if
  786.                 End if
  787.                                 
  788.             End if
  789.             
  790.             'Function call to set the SSL port in the registry 
  791.             If not updatePortNumber( CONST_SSL_PORTNAME, nSecureport ) Then    
  792.                 SA_SetErrMsg L_REGISTRY_PORT_NUMBERS_NOTSET_ERRORMESSAGE
  793.                 Exit Function
  794.             End If
  795.                 
  796.             'Function call to set the Default port in the registry 
  797.             If not updatePortNumber( CONST_DEFAULT_PORTNAME , nport ) Then    
  798.                 SA_SetErrMsg L_REGISTRY_PORT_NUMBERS_NOTSET_ERRORMESSAGE
  799.                 Exit Function
  800.             End If
  801.             
  802.                     
  803. %>
  804.             <SCRIPT LANGUAGE="JAVASCRIPT" >
  805.             {
  806.                 top.location.href = "<%=mstrReturnURL%>"                    
  807.             }
  808.             </SCRIPT>
  809. <%    
  810.             Response.Flush            
  811.             
  812.             'Put the values in WMI                    
  813.             objServerSetting.Put_
  814.             
  815.         Next    
  816.         
  817.         'Error while putting the web server settings
  818.         If Err.Number <> 0 Then
  819.             Call SA_SetErrMsg (L_COULDNOT_IIS_WEBSERVERSETTING_ERRORMESSAGE & " (" & HEX(Err.Number) & ")" )
  820.             Exit Function
  821.         End If
  822.         
  823.         'Release the objects
  824.         Set objNetWorkCon    =    nothing
  825.         set objinst            =    nothing
  826.         set objNACCollection =  nothing
  827.         set objServerSetting =  nothing
  828.         Set objAdminService    =   nothing
  829.         Set objService        =   nothing
  830.         
  831.         SetAdminConfig = TRUE    'success
  832.                 
  833.     End Function    
  834.     
  835.     '-------------------------------------------------------------------------
  836.     'Function name:        updatePortNumber
  837.     'Description:        Serves in updating the port in the registry
  838.     'Input Variables:    strPortKey    -Key name 
  839.     '                    nportNumber    -Port no
  840.     'Output Variables:    None
  841.     'Returns:            True /False
  842.     'Global Variables:    L_(*)
  843.     '-------------------------------------------------------------------------
  844.     Function updatePortNumber(strPortKey,nportNumber)
  845.         On Error Resume Next
  846.         Err.Clear
  847.                 
  848.         Dim objRegistry        'Object for registry connection
  849.         Dim bReturnValue    'Boolean value
  850.         
  851.         Const CONST_PORT_REGKEYPATH ="SOFTWARE\Microsoft\ServerAppliance\WebFramework"
  852.         updatePortNumber=False    'Default initialization
  853.         
  854.         Set objRegistry=RegConnection()    'Connecting to the registry         
  855.         
  856.         If Err.number <> 0 Then 
  857.             SA_SetErrMsg L_REGISTRYCONNECTIONFAIL_ERRORMESSAGE 
  858.             Exit Function
  859.         End If
  860.     
  861.         bReturnValue = updateRegkeyvalue(objRegistry ,CONST_PORT_REGKEYPATH , strPortKey , nportNumber , CONST_DWORD )
  862.     
  863.         If bReturnValue = False Then    'If return status is error 
  864.             Exit function    
  865.         End If
  866.         
  867.         Set objRegistry = Nothing
  868.         
  869.         updatePortNumber=TRUE    ' on success 
  870.         
  871.     End function
  872.     '-------------------------------------------------------------------------
  873.     'Function name:        GetAdminWebSite
  874.     'Description:        Get Admin web site name
  875.     'Input Variables:    objAdminService
  876.     'Output Variables:    None
  877.     'Global Variables:    L_(*)
  878.     'Returns:            Admin web site name
  879.     '-------------------------------------------------------------------------
  880.     Function GetAdminWebSite(objAdminService)
  881.         
  882.         Err.Clear
  883.         On Error Resume Next
  884.                         
  885.         Dim strWMIpath                'WMI query
  886.         Dim objSiteCollection        'Get instance of IIs_WebServerSetting class
  887.         Dim objSite                    'Get instances of IIs_WebServerSetting class
  888.         Dim objHTTPAdminService        
  889.         
  890.         Call SA_TraceOut( SOURCE_FILE, "GetAdminWebSite")
  891.         
  892.         'Constant for the admin web site
  893.         Const CONST_MANAGEDSITENAME = "Administration"
  894.         
  895.         Set objHTTPAdminService = objAdminService
  896.         
  897.         'WMI query        
  898.         'XPE only has one website
  899.         If CONST_OSNAME_XPE = GetServerOSName() Then                
  900.             'WMI query
  901.             strWMIpath = "Select * from " & GetIISWMIProviderClassName("IIs_WebServerSetting") & " where Name =" & chr(34) & GetCurrentWebsiteName() & chr(34)
  902.         Else 
  903.                strWMIpath = "Select * from " & GetIISWMIProviderClassName("IIs_WebServerSetting") & " where ServerComment =" & chr(34) & CONST_MANAGEDSITENAME & chr(34)
  904.         End If
  905.         
  906.         'Create instance of IIs_WebServerSetting
  907.         Set objSiteCollection = objHTTPAdminService.ExecQuery(strWMIpath)
  908.             
  909.         If Err.Number <> 0 Then
  910.             Call SA_ServeFailurePage (L_IIS_WEBSERVERCONNECTION_ERRORMESSAGE & " (" & HEX(Err.Number) & ")")
  911.             Exit Function
  912.         End If
  913.         
  914.         'Get the admin web site name
  915.         For each objSite in objSiteCollection
  916.             GetAdminWebSite = objSite.Name
  917.             Exit For
  918.         Next
  919.         
  920.         'If admin site name is empty display error
  921.         If GetAdminWebSite = "" Then
  922.             Call SA_ServeFailurePage (L_COULDNOT_ADMIN_WEBSITE_ERRORMESSAGE)
  923.             Exit Function
  924.         End If
  925.         
  926.         'Release objects
  927.         Set objSite = Nothing
  928.         Set objSiteCollection = Nothing
  929.         Set objHTTPAdminService = Nothing
  930.         
  931.     End Function    
  932.     
  933.     '-------------------------------------------------------------------------
  934.     'Subroutine name:    GetSystemNICConfig
  935.     'Desription:        Gets all the NIC IP's from the system
  936.     'Input Variables:    F_strNonEncryptedIPAddress
  937.     'Output variables:  None
  938.     'Global Variables:    G_objService,CONST_WMI_WIN32_NAMESPACE,L_(*)
  939.     '-------------------------------------------------------------------------
  940.     Sub GetSystemNICConfig(F_strNonEncryptedIPAddress)
  941.         
  942.         Err.clear
  943.         On Error Resume Next
  944.                 
  945.         Dim objConfiguredIPs    'To get instance of win32_NetworkAdapterConfiguration
  946.         Dim objNICIP            'To get instances of win32_NetworkAdapterConfiguration
  947.         Dim strNICQuery            'WMI query
  948.         Dim nCount                'Count to get IP address for all NIC cards
  949.         Dim arrIPList(13)        'Array to store all the IP addresses
  950.         
  951.         Call SA_TraceOut( SOURCE_FILE, "GetSystemNICConfig")
  952.                 
  953.         'Connecting to the WMI server
  954.         Set G_objService = GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  955.         
  956.         If Err.number <> 0 Then
  957.             Call SA_ServeFailurePage (L_WMICONNECTIONFAILED_ERRORMESSAGE & " (" & HEX(Err.Number) & ")" )
  958.             Exit Sub
  959.         End if
  960.         
  961.         'WMI query        
  962.         strNICQuery = "select * from win32_NetworkAdapterConfiguration Where IPEnabled = true"
  963.         
  964.         'Getting instance of win32_NetworkAdapterConfiguration
  965.         Set objConfiguredIPs = G_objService.ExecQuery(strNICQuery)
  966.          
  967.         If Err.number <> 0 then
  968.             Call SA_ServeFailurePage (L_FAILEDTOGET_IPADDRESS_ERRORMESSAGE & " (" & HEX(Err.Number) & ")" )
  969.             Exit Sub
  970.         End If
  971.     
  972.         'Populate the IP address combo box
  973.         For each objNICIP in objConfiguredIPs
  974.             If IsArray(objNICIP.IPAddress) Then 
  975.                 For nCount = 0 to ubound(objNICIP.IPAddress)
  976.                     Redim arrIPList(ubound(objNICIP.IPAddress))
  977.                     arrIPList(nCount) = objNICIP.IPAddress(nCount)
  978.                     If arrIPList(nCount) <> "" Then
  979.                         If (arrIPList(nCount) = F_strNonEncryptedIPAddress ) Then
  980.                             Response.Write "<OPTION  VALUE='" & arrIPList(nCount) &"' SELECTED >" & arrIPList(nCount) & "</OPTION>"
  981.                         Else
  982.                             Response.Write "<OPTION  VALUE='" & arrIPList(nCount) &"' >" & arrIPList(nCount) & "</OPTION>" 
  983.                         End IF
  984.                     End If 
  985.                 Next
  986.             End If
  987.         Next
  988.                 
  989.         'Release objects
  990.         Set objConfiguredIPs = nothing
  991.         Set objNICIP = nothing
  992.                 
  993.     End Sub
  994.     
  995.     '-------------------------------------------------------------------------
  996.     'Function name:        GetSystemSettings
  997.     'Description:        Serves in getting the IP addresses, encrypted and non-encrypted
  998.     '                    port number from System for Admin web site
  999.     'Input Variables:    None
  1000.     'Output Variables:    None
  1001.     'Returns:            True/False
  1002.     'Global Variables:    G_objAdminService, CONST_WMI_IIS_NAMESPACE, L_(*),F(*)
  1003.     '-------------------------------------------------------------------------
  1004.     Function GetSystemSettings()
  1005.     
  1006.         Err.Clear 
  1007.         On Error resume Next
  1008.         
  1009.         Dim objNACCollection    'Object to get WMI connection
  1010.         Dim objinst                'Getting instances of IIs_WebServerSetting
  1011.         Dim arrWinsSrv            'Array to store the IP address and non-encrypted port number
  1012.         Dim arrWinsSecureSrv    'Array to store the IP address and encrypted port number
  1013.         Dim arrIPAdd            'Array to store the IP address for non-encrypted sites 
  1014.         Dim arrPort                'Array to store the port for non-encrypted sites 
  1015.         Dim arrSecureIPAdd        'Array to store the IP address for encrypted sites 
  1016.         Dim arrSecurePort        'Array to store the port for encrypted sites 
  1017.         Dim nIPCount            'Count for getting the IP address and encrypted port number
  1018.         Dim strServerBindings            'To store the values obtained from ServerBindings property
  1019.         Dim strAdminWebSite        'Admin web site name
  1020.         Dim nSecureCount        'Count for getting the IP address and encrypted port number
  1021.         Dim strSecureBindings        'To store the values obtained from SecureBindings property
  1022.         Dim strIISAdminWebSite    'IIS Admin Web Site name
  1023.         Dim objIISVirtualDir    'Getting the IIs_WebVirtualDirSetting instance 
  1024.         Dim objIISDirInstances    'Getting the IIs_WebVirtualDirSetting instances 
  1025.         Dim strAccessSSL        'To store AccessSSL value
  1026.         
  1027.         Call SA_TraceOut( SOURCE_FILE, "GetSystemSettings")
  1028.         
  1029.         Const CONST_ARR_INDEX_IP = 0    'For IP address
  1030.         Const CONST_ARR_INDEX_PORT = 1    'For port number
  1031.         
  1032.         'Connecting to the WMI server
  1033.         Set G_objAdminService    = GetWMIConnection(CONST_WMI_IIS_NAMESPACE) 
  1034.                 
  1035.         'Get the HTTP admin web site name
  1036.         strAdminWebSite = GetAdminWebSite(G_objAdminService)
  1037.         
  1038.         strIISAdminWebSite = strAdminWebSite & "/Root"
  1039.         
  1040.         'Getting the admin web server setting instance 
  1041.         Set objNACCollection = G_objAdminService.ExecQuery("Select * from  " & GetIISWMIProviderClassName("IIs_WebServerSetting") & " where Name=" & Chr(34)& strAdminWebSite & Chr(34))
  1042.     
  1043.         If Err.Number <> 0 Then
  1044.             Call SA_ServeFailurePage (L_IIS_WEBSERVERCONNECTION_ERRORMESSAGE & " (" & HEX(Err.Number) & ")")
  1045.             GetSystemSettings = False
  1046.             Exit Function
  1047.         End If
  1048.     
  1049.         For each objinst in objNACCollection
  1050.             If IsArray(objinst.ServerBindings) Then 
  1051.                 'Getting the IP address and non-encrypted port number from server bindings property
  1052.                 For nIPCount = 0 to ubound(objinst.ServerBindings)        
  1053.                     strServerBindings = objinst.ServerBindings(nIPCount)
  1054.                     
  1055.                     if IsIIS60Installed() Then
  1056.                     
  1057.                         If IsObject(objinst.ServerBindings(nIPCount)) then 
  1058.                             
  1059.                             arrIPAdd = objinst.ServerBindings(nIPCount).IP
  1060.                             arrPort = objinst.ServerBindings(nIPCount).Port
  1061.                             F_strNonEncryptedIPAddress = arrIPAdd 
  1062.                             F_nNonEncryptedPort =arrPort
  1063.                             
  1064.                         End if 'If IsObject(..)
  1065.                         
  1066.                     Else 
  1067.                     
  1068.                         If strServerBindings <> "" then 
  1069.                             'split the strServerBindings array to get the IP address and port number
  1070.                             arrWinsSrv = split(strServerBindings,":")        
  1071.                             arrIPAdd = arrWinsSrv(CONST_ARR_INDEX_IP)
  1072.                             arrPort = arrWinsSrv(CONST_ARR_INDEX_PORT)
  1073.                             F_strNonEncryptedIPAddress = arrIPAdd 
  1074.                             F_nNonEncryptedPort =arrPort
  1075.                         End if
  1076.                         
  1077.                     End If 'if IsIIS60Installed()
  1078.                   Next
  1079.               End If
  1080.               
  1081.               If IsArray(objinst.SecureBindings) Then 
  1082.                   'Getting the IP address and encrypted port number from secure bindings property
  1083.                   For nSecureCount = 0 to ubound(objinst.SecureBindings)        
  1084.                     strSecureBindings = objinst.SecureBindings(nSecureCount)
  1085.                     
  1086.                     if IsIIS60Installed() Then
  1087.                     
  1088.                         If IsObject(objinst.SecureBindings(nSecureCount)) then 
  1089.                                                     
  1090.                             arrSecureIPAdd = objinst.SecureBindings(nSecureCount).IP
  1091.                             arrSecurePort = objinst.SecureBindings(nSecureCount).Port
  1092.                             
  1093.                             If IsEmpty(arrSecurePort) or IsNull(arrSecurePort) Then                            
  1094.                                 arrSecurePort = ""                                
  1095.                             Else                    
  1096.                                 'Get rid of the ':'
  1097.                                 arrSecurePort = CLng(Replace(arrSecurePort, ":", ""))            
  1098.                             End If
  1099.                                                         
  1100.                             F_strEncryptedIPAddress = arrSecureIPAdd
  1101.                             F_nEncryptedPort = arrSecurePort
  1102.                             
  1103.                         End if 'If IsObject(...)
  1104.                     
  1105.                     Else
  1106.                     
  1107.                         If strSecureBindings  <> "" then 
  1108.                             'split the strServerBindings array to get the IP address and port number
  1109.                             arrWinsSecureSrv  = split(strSecureBindings,":")        
  1110.                             arrSecureIPAdd = arrWinsSecureSrv(CONST_ARR_INDEX_IP)
  1111.                             arrSecurePort = arrWinsSecureSrv(CONST_ARR_INDEX_PORT)
  1112.                             F_strEncryptedIPAddress = arrWinsSecureSrv(CONST_ARR_INDEX_IP)
  1113.                             F_nEncryptedPort = arrWinsSecureSrv(CONST_ARR_INDEX_PORT)
  1114.                         End if 
  1115.                         
  1116.                     End If 'if IsIIS60Installed() 
  1117.                 Next
  1118.             End If
  1119.           Next 
  1120.         
  1121.         'Error in getting the server IP address, encrypted and non-encrypted port number
  1122.         If Err.Number <> 0 Then
  1123.             Call SA_ServeFailurePage (L_COULDNOT_IIS_WEBSERVER_OBJECT_ERRORMESSAGE & " (" & HEX(Err.Number) & ")")
  1124.             GetSystemSettings = False
  1125.             Exit Function
  1126.         End If
  1127.         
  1128.         'Getting the IIs_WebVirtualDirSetting instance 
  1129.         Set objIISVirtualDir = G_objAdminService.ExecQuery("Select * from  " & GetIISWMIProviderClassName("IIs_WebVirtualDirSetting") & " where Name=" & Chr(34)& strIISAdminWebSite & Chr(34))
  1130.         
  1131.         If Err.Number <> 0 Then
  1132.             Call SA_ServeFailurePage (L_IIS_WEBSERVERCONNECTION_ERRORMESSAGE & " (" & HEX(Err.Number) & ")")
  1133.             GetSystemSettings = False
  1134.             Exit Function
  1135.         End If
  1136.         
  1137.                 
  1138.         Set objIISVirtualDir = Nothing
  1139.         Set objIISDirInstances = Nothing
  1140.         
  1141.         'Set the Radion button status depending on the system settings    
  1142.         If arrIPAdd = ""  and arrSecureIPAdd = "" then 
  1143.             F_strAll_IPAddress = CONST_ARR_STATUS_CHECKED
  1144.             F_strJustthis_IPAddress =""
  1145.             F_strradIPAdd = CONST_ARR_STATUS_TRUE
  1146.         ElseIf ((arrIPAdd <> "" and arrSecureIPAdd <> "") and (arrIPAdd = arrSecureIPAdd)) then 
  1147.             F_strJustthis_IPAddress = CONST_ARR_STATUS_CHECKED
  1148.             F_strAll_IPAddress = ""
  1149.             F_strradIPAdd = CONST_ARR_STATUS_FALSE
  1150.         Else
  1151.             F_strJustthis_IPAddress = ""
  1152.             F_strAll_IPAddress = ""
  1153.             F_strradIPAdd = CONST_ARR_STATUS_NONE
  1154.         End if 
  1155.         
  1156.         'Release objects
  1157.         Set objinst = Nothing
  1158.         Set objNACCollection = Nothing
  1159.                     
  1160.         GetSystemSettings = True
  1161.                     
  1162.     End Function
  1163. %>
  1164.